package com.aspose.cells;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

class zbsd extends zbz {
   zbsd() {
      this.c(438);
      this.b(18);
      this.c = new byte[18];
      this.c[1] = 2;
   }

   ArrayList a(Shape var1, zbtz var2, int var3, int var4) {
      boolean var5 = false;
      if (var1.X() != null) {
         switch(var1.getMsoDrawingType()) {
         case 1:
         case 2:
         case 3:
         case 4:
         case 6:
         case 9:
         case 30:
            var5 = true;
         }
      }

      if (var5) {
         int var6 = 6 + var1.X().length;
         boolean var7 = var6 % 2 != 0;
         if (var7) {
            ++var6;
         }

         this.b(this.d() + (short)var6);
         this.c = new byte[this.d()];
         System.arraycopy(com.aspose.cells.b.a.zc.a(var6), 0, this.c, 16, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var1.X().length), 0, this.c, 18, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(174200844), 0, this.c, 20, 4);
         System.arraycopy(var1.X(), 0, this.c, 24, var1.X().length);
         if (var7) {
            this.c[this.c.length - 1] = var1.X()[3];
         }
      }

      switch(var2.g()) {
      case 1:
         this.c[0] = (byte)(this.c[0] | 4);
         break;
      case 2:
      case 4:
      case 5:
      default:
         this.c[0] = (byte)(this.c[0] | 2);
         break;
      case 3:
         this.c[0] = (byte)(this.c[0] | 14);
         break;
      case 6:
         this.c[0] = (byte)(this.c[0] | 8);
         break;
      case 7:
         this.c[0] = (byte)(this.c[0] | 2);
         break;
      case 8:
         this.c[0] = (byte)(this.c[0] | 6);
      }

      switch(var2.h()) {
      case 0:
         this.c[0] = (byte)(this.c[0] | 48);
         break;
      case 1:
         this.c[0] = (byte)(this.c[0] | 32);
         break;
      case 2:
      case 4:
      case 5:
      case 7:
      case 8:
      default:
         this.c[0] = (byte)(this.c[0] | 16);
         break;
      case 3:
         this.c[0] = (byte)(this.c[0] | 112);
         break;
      case 6:
         this.c[0] = (byte)(this.c[0] | 64);
         break;
      case 9:
         this.c[0] = (byte)(this.c[0] | 16);
      }

      switch(var2.f()) {
      case 0:
         this.c[2] = 3;
         break;
      case 1:
         this.c[2] = 2;
      case 2:
      default:
         break;
      case 3:
         this.c[2] = 1;
      }

      if (!var2.m()) {
         this.c[1] = 0;
      }

      if ((var4 & '\uffff') == 0) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(var4), 0, this.c, 10, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a((int)0), 0, this.c, 12, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var3), 0, this.c, 14, 2);
         return null;
      } else {
         ArrayList var11 = new ArrayList();
         zbsx var12;
         if (var2.p() != null && var2.p().size() != 0) {
            Collections.sort(var2.p(), new zhx());
            int var8 = 0;
            Iterator var9 = var2.p().iterator();

            label90:
            while(true) {
               FontSetting var10;
               while(true) {
                  if (!var9.hasNext()) {
                     if (var8 < (var4 & '\uffff')) {
                        var12 = new zbsx();
                        var12.a = var8;
                        var12.b = var3;
                        com.aspose.cells.b.a.a.ze.a(var11, (Object)var12);
                     }

                     var12 = new zbsx();
                     var12.a = var4 & '\uffff';
                     var12.b = var3;
                     com.aspose.cells.b.a.a.ze.a(var11, (Object)var12);
                     break label90;
                  }

                  var10 = (FontSetting)var9.next();
                  if (var10.getStartIndex() < var8) {
                     if (var10.getStartIndex() + var10.getLength() <= var8) {
                        continue;
                     }

                     var12 = new zbsx();
                     var12.a = var8;
                     var12.b = var3;
                     com.aspose.cells.b.a.a.ze.a(var11, (Object)var12);
                     break;
                  }

                  if (var10.getStartIndex() > var8) {
                     var12 = new zbsx();
                     var12.a = var8;
                     var12.b = var3;
                     com.aspose.cells.b.a.a.ze.a(var11, (Object)var12);
                  }

                  var12 = new zbsx();
                  var12.a = var10.getStartIndex();
                  if (var10.c() == null) {
                     var12.b = var3;
                  } else {
                     var12.b = var10.getFont().j();
                  }

                  com.aspose.cells.b.a.a.ze.a(var11, (Object)var12);
                  break;
               }

               var8 = var10.getStartIndex() + var10.getLength();
            }
         } else {
            var12 = new zbsx();
            var12.a = 0;
            var12.b = var3;
            com.aspose.cells.b.a.a.ze.a(var11, (Object)var12);
            var12 = new zbsx();
            var12.a = var4 & '\uffff';
            var12.b = var3;
            com.aspose.cells.b.a.a.ze.a(var11, (Object)var12);
         }

         System.arraycopy(com.aspose.cells.b.a.zc.a(var4), 0, this.c, 10, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var11.size() * 8), 0, this.c, 12, 2);
         return var11;
      }
   }
}
